<?php
	/* Template Name: Fullwidth */
?>
<?php get_header(); ?>
	<div class="grid_12 single-page">
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<?php 
		$comment_type = get_post_meta(get_the_ID(), 'reedwan_comments_type', true);  
		$featured_image = get_post_meta(get_the_ID(), 'reedwan_featured_image', true);
		$user_rating = get_post_meta(get_the_ID(), 'reedwan_user_rating', true);
		$sidebar_position = get_option('reedwan_sidebar_position', 'true');  
		?>
		<?php if($featured_image=='Yes'):  ?>
				<?php if (has_post_thumbnail()): ?> 		
				<?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');?>
				<!-- Featured Image -->
				<div class="featured-image-post">
					<a class="standard-format-icon" href="<?php echo $large_image_url[0];?>" rel="prettyPhoto">
					<?php the_post_thumbnail('full-slider', array('class' => 'overlay')); ?>
					</a>
				</div>
				<?php endif; ?>
			<?php endif; ?>
		<div class="single-title">
			<h1><?php the_title(); ?></h1>	
		</div>
		<div class="clear"></div>
		<div class="single-content">
			<?php the_content(); ?>
			<?php if($user_rating=='Yes'):  ?>
			<div class="user-review-criteria">
				<span class="user-review-description">
				<b>
				<span class="your_rating" style="display:none;"><?php _e('Your Rating', 'unicorn'); ?>
				</span>
				<span class="user_rating"><?php _e('User Rating', 'unicorn'); ?></span>
				</b>: 
				<span
					class="score"><?php echo $ratings->current_rating; ?></span> <em>(<span
					class="count"><?php echo $ratings->count; ?></span> <?php _e('votes', 'unicorn'); ?>)</em>
				</span>
						
				<span class="user-review-rating">
					<span class="criteria-star-under">
						<span class="criteria-star-top" style="width:<?php echo $ratings->current_position; ?>%">
						</span>
					</span>
				</span>
			</div>
			<?php endif; ?>
		</div>
		</div>
		<?php if($comment_type == 'Both'): ?>
		<?php 
			// Get the current page url for FB comments
			$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
		?>	
		<!-- FB Comments -->
		<div class="fb-comments" data-href="<?php echo $url; ?>" data-num-posts="4" data-width="628"></div>
		
		<!-- WP Comments -->
		<div class="single-comments">
			<?php comments_template(); ?>
		</div>
		<?php endif; ?>
		
		
		<?php if($comment_type == 'Facebook'): ?>
		<?php 
			// Get the current page url for FB comments
			$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
		?>	
		<!-- FB Comments -->
		<div class="fb-comments" data-href="<?php echo $url; ?>" data-num-posts="4" data-width="628"></div>
		<?php endif; ?>
		
		<?php if($comment_type == 'WP'): ?>
		<!-- WP Comments -->
		<div class="single-comments">
			<?php comments_template(); ?>
		</div>
		<?php endif; ?>
		
		<?php endwhile; endif; ?>
	</div>
<?php get_footer(); ?>